<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" >
        <title></title>
    </head>
    <body>
        <script>
            function a(){
                var n = 1;
                add = function(){
                    n+=1;
                }
                function b(){
                    alert(n);
                }
                return b;
            }
            var rea = a();
            rea();
            add();
            rea();
        </script>
    </body>
</html>